package look4ss.aplicativo.fragments;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import look4ss.aplicativo.R;

public class Nav extends Fragment{

    private static ViewPager vPager;
    private TabLayout TL;

    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.pager_abas, container, false);
        vPager = v.findViewById(R.id.pager);
        TL = v.findViewById(R.id.layout_aba);
        vPager.setAdapter(new AdapterAbas(getChildFragmentManager()));
        TL.setupWithViewPager(vPager);
        setHasOptionsMenu(true);
        return v;
    }

    class AdapterAbas extends FragmentPagerAdapter {
        public AdapterAbas(FragmentManager FM) {
            super(FM);
        }

        @Override
        public int getCount() {
            return 99;
        }

        @Override
        public Fragment getItem(int i) { return new AbaMapa(); }
         }
        }